keyhandler: Do not serialise keyhandlers; increase scratch array size.
authorKeir Fraser <keir.fraser@citrix.com>
Fri, 12 Feb 2010 09:21:57 +0000 (09:21 +0000)
committerKeir Fraser <keir.fraser@citrix.com>
Fri, 12 Feb 2010 09:21:57 +0000 (09:21 +0000)
Although serialising keyhandlers is safer, and in particular
protects access to shared heyhandler_scratch[], in debug scenarios it
is probably better to 'have a go' when requested - and assume the user
knows what they are doing.

Meanwhile, increase scratch array size to 1024. That's enough for more
than a dozen lines of 80-column text, and should be plenty in any
practical situation.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
xen/common/keyhandler.c
xen/include/xen/keyhandler.h

index 78daf45a3def8bc11401819514848ac519592223..e3e64a19535a9eddc1b72b3d5b253d7bf114547a 100644 (file)
@@ -20,7 +20,7 @@
 static struct keyhandler *key_table[256];
 static unsigned char keypress_key;
 
-char keyhandler_scratch[100];
+char keyhandler_scratch[1024];
 
 static void keypress_action(unsigned long unused)
 {
@@ -31,7 +31,6 @@ static DECLARE_TASKLET(keypress_tasklet, keypress_action, 0);
 
 void handle_keypress(unsigned char key, struct cpu_user_regs *regs)
 {
-    static bool_t executing_handler;
     struct keyhandler *h;
 
     if ( (h = key_table[key]) == NULL )
@@ -39,18 +38,9 @@ void handle_keypress(unsigned char key, struct cpu_user_regs *regs)
 
     if ( !in_irq() || h->irq_callback )
     {
-        /*
-         * No concurrent handler execution: prevents garbled console and
-         * protects keyhandler_scratch[].
-         */
-        if ( test_and_set_bool(executing_handler) )
-            return;
-        wmb();
         console_start_log_everything();
         h->irq_callback ? (*h->u.irq_fn)(key, regs) : (*h->u.fn)(key);
         console_end_log_everything();
-        wmb();
-        executing_handler = 0;
     }
     else
     {
index 1670d7d7f9977f3132bc2f886827844d92415f62..d3ab0a90fd82d7ca59ad8cf6ec0f59e11539ad6b 100644 (file)
@@ -53,6 +53,6 @@ extern void register_keyhandler(unsigned char key, struct keyhandler *handler);
 extern void handle_keypress(unsigned char key, struct cpu_user_regs *regs);
 
 /* Scratch space is available for use of any keyhandler. */
-extern char keyhandler_scratch[100];
+extern char keyhandler_scratch[1024];
 
 #endif /* __XEN_KEYHANDLER_H__ */